package com.norteksoft.erm.model;

import org.apache.commons.lang.builder.HashCodeBuilder;

/**
 * 数据角色
 * 
 * @hibernate.class table="ERM_DATAROLE"
 * @author Jiffy
 * 
 */
public class DataRole extends BaseObject {

	public static final String TYPE_USERNAMES = "userNames";

	public static final String TYPE_USERNAME = "userName";

	private Long OID = new Long(-1);

	private String name;// 角色名称

	private String code;// 角色标识（必须唯一）

	private String attribute;// 条件属性(java类属性)

	private String dbAttribute;// 条件属性对应的数据库/全文检索字段

	private String attributeType;// 属性类型

	private DataResource dataResource;// 所属数据资源类型

	private String[] authzMode;// 按角色授权模式

	public int hashCode() {
		return new HashCodeBuilder().append(OID).append(name).append(code)
				.append(attribute).append(dbAttribute).append(attributeType)
				.append(authzMode).toHashCode();
	}

	/**
	 * @hibernate.id column="OID" unsaved-value="-1" type="long"
	 * @hibernate.generator class="sequence"
	 * @hibernate.param name="sequence" value="ERM_SEQUENCE"
	 */
	public Long getOID() {
		return OID;
	}

	public void setOID(Long oid) {
		OID = oid;
	}

	/**
	 * @hibernate.property column="NAME" length="60" type="string"
	 *                     not-null="true"
	 * @return String
	 */

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @hibernate.property column="CODE" length="60" type="string"
	 *                     not-null="true"
	 * @return String
	 */

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	/**
	 * @hibernate.many-to-one name="dataResource" column="DATARESOURCEOID"
	 *                        class="com.norteksoft.erm.model.DataResource"
	 */

	public DataResource getDataResource() {
		return dataResource;
	}

	public void setDataResource(DataResource dataResource) {
		this.dataResource = dataResource;
	}

	/**
	 * @hibernate.property column="ATTRIBUTE" length="20" type="string"
	 *                     not-null="true"
	 * @return String
	 */

	public String getAttribute() {
		return attribute;
	}

	public void setAttribute(String attribute) {
		this.attribute = attribute;
	}

	/**
	 * @hibernate.property column="AUTHZMODE" length="32"
	 *                     type="com.norteksoft.erm.model.hibernate.usertype.AuthzMode"
	 *                     not-null="true"
	 * @return String
	 */
	public String[] getAuthzMode() {
		return authzMode;
	}

	public void setAuthzMode(String[] authzMode) {
		this.authzMode = authzMode;
	}

	/**
	 * @hibernate.property column="ATTRIBUTETYPE" length="10" type="string"
	 *                     not-null="true"
	 * @return String
	 */

	public String getAttributeType() {
		return attributeType;
	}

	public void setAttributeType(String attributeType) {
		this.attributeType = attributeType;
	}

	/**
	 * @hibernate.property column="DBATTRIBUTE" length="60" type="string"
	 * @return String
	 */
	public String getDbAttribute() {
		return dbAttribute;
	}

	public void setDbAttribute(String dbAttribute) {
		this.dbAttribute = dbAttribute;
	}

}
